﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NCMIS.Client;

namespace EPiServer.Web.Hosting
{
    public static class ConvenientExtensions
    {
        public static CmisWebRequest GetCmisWebRequest(this VirtualPathUnifiedProvider provider)
        {
            // Read credentials and service doc URI from episerver.config
            string userName = provider.ConfigurationParameters["userName"];
            string password = provider.ConfigurationParameters["password"];
            string serviceDocURI = provider.ConfigurationParameters["serviceDocumentUri"];

            // Create a (CMIS) web request
            return new CmisWebRequest(userName, password, new Uri(serviceDocURI));
        }
    }
}
